package com.itany.corejava.code08_集合.map集合;

import java.util.Enumeration;
import java.util.Properties;

/**
 * @author MissChen
 * @date 2024年03月06日 10:17
 */
public class Test08_获取系统属性 {
    public static void main(String[] args) {
        Properties properties = System.getProperties();
        // System.out.println(properties);
        Enumeration<Object> keys = properties.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            String value = properties.getProperty(key);
            System.out.println(key + "=" + value);
        }
        System.out.println("-----------------------");
        //根据key获取指定的属性值
        System.out.println("javaHome:" + System.getProperty("java.home"));
        System.out.println("编码:" + System.getProperty("file.encoding"));
        System.out.println("java版本:" + System.getProperty("java.version"));

    }
}
